bitkeeper revision 1.1159.279.1 (424c70f4QCqyymdEdrsWpGJWoWos9A)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 31 Mar 2005 21:51:48 +0000 (21:51 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 31 Mar 2005 21:51:48 +0000 (21:51 +0000)
Fix queue unplugging in blkback driver.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
linux-2.6.11-xen-sparse/drivers/xen/blkback/common.h
linux-2.6.11-xen-sparse/drivers/xen/blkback/vbd.c

index 9fb789216c6a8ff7d97c5f90de7a7c9a1bc4f752..be250a4bf3ab86c0104ff7aafd62e092fa19ca6c 100644 (file)
@@ -68,16 +68,10 @@ static PEND_RING_IDX pending_prod, pending_cons;
 static kmem_cache_t *buffer_head_cachep;
 #else
 static request_queue_t *plugged_queue;
-void bdev_put(struct block_device *bdev)
+static inline void bdev_flush_queue(request_queue_t *q)
 {
-    request_queue_t *q = plugged_queue;
-    /* We might be giving up last reference to plugged queue. Flush if so. */
-    if ( (q != NULL) &&
-         (q == bdev_get_queue(bdev)) && 
-         (cmpxchg(&plugged_queue, q, NULL) == q) )
-        blk_run_queue(q);
-    /* It's now safe to drop the block device. */
-    blkdev_put(bdev);
+    if ( q->unplug_fn != NULL )
+        q->unplug_fn(q);
 }
 #endif
 
@@ -195,7 +189,7 @@ static int blkio_schedule(void *arg)
 #else
         if ( plugged_queue != NULL )
         {
-            blk_run_queue(plugged_queue);
+            bdev_flush_queue(plugged_queue);
             plugged_queue = NULL;
         }
 #endif
@@ -523,7 +517,7 @@ static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req)
         if ( (q = bdev_get_queue(bio->bi_bdev)) != plugged_queue )
         {
             if ( plugged_queue != NULL )
-                blk_run_queue(plugged_queue);
+                bdev_flush_queue(plugged_queue);
             plugged_queue = q;
         }
 
index 8f8a5217025594c093f241b4b53c3b17bf10a9f6..4a12ca8fe9644184aa5d3368c1462ec29244d3f0 100644 (file)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 typedef struct rb_root rb_root_t;
 typedef struct rb_node rb_node_t;
-extern void bdev_put(struct block_device *bdev);
 #else
 struct block_device;
-#define bdev_put(_b) ((void)0)
 #endif
 
 typedef struct blkif_st {
index 639b8fc5d5b2c4ca074cf24969073fa05f4658f5..90d194680bbdb4590b6bee834db3bb2884f1abfa 100644 (file)
@@ -14,6 +14,9 @@
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static dev_t vbd_map_devnum(blkif_pdev_t);
+#define bdev_put(_b) blkdev_put(_b)
+#else
+#define bdev_put(_b) ((void)0)
 #endif
 
 void vbd_create(blkif_be_vbd_create_t *create)